Using a handler other than "handler"

Using a handler other than "handler"

am 27.09.2010 10:20:51 von bertolini.cedric

--000e0cd5a01e12372c0491396866
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello,

I apologize for such a trivial question, but I'd like to use a function
other than "handler" as a perl handler. According to the doc, it was
possible in mod_perl 1, but I can't manage to get it to work under mod_perl
2.


Here is an example of my code:

file Authen.pm

> sub handler {
> // regular handling
> }
>
> sub special {
> // special case
> }

file httpd.conf

>
> PerlAuthenHandler /lib/Authen
>


>
> # I want to override the regular case by using "special" instead of
"handler" in /lib/Authen.pm
>


Thanks in advance,
C=E9dric Bertolini

--000e0cd5a01e12372c0491396866
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello,

I apolog=
ize for such a trivial question, but I'd like to use a function other t=
han "handler" as a perl handler. According to the doc, it was pos=
sible in mod_perl 1, but I can't manage to get it to work under mod_per=
l 2.



Here is an example of my code:

file Authen.pm

> su=
b handler {
> =A0 // regular handling
> }
>
> sub =
special {
> =A0 // special case
> }

file httpd.conf
<=
br>
> <Location /perl/>
>=A0 =A0 PerlAuthenHandler=A0 /lib/Authe=
n
> </Location>

> <Location /perl/special-case/>=
;
> =A0 # I want to override the regular case by using "special&=
quot; instead of "handler" in /lib/Authen.pm

> </Location>

Thanks in advance,
C=E9dric Bertolini
<=
br>


--000e0cd5a01e12372c0491396866--

Re: Using a handler other than "handler"

am 27.09.2010 10:28:35 von Michel Jansen

This is a multi-part message in MIME format.
--------------090503040900080903040702
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Cédric,

Je schreef:
> Hello,
>
> I apologize for such a trivial question, but I'd like to use a
> function other than "handler" as a perl handler. According to the doc,
> it was possible in mod_perl 1, but I can't manage to get it to work
> under mod_perl 2.

I am using Apache2::RequestRec which fine for me. I am using it as an
AuthenHandler and as the starter for our restfull web application!

Questions?

Grtz,

Michel

--------------090503040900080903040702
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit




http-equiv="Content-Type">



Cédric,



Je schreef:
cite="mid:AANLkTinNEAvkgGpMjr+KzDLqcBNxTFvvZ-Z1f-OuG1+5@mail .gmail.com"
type="cite">Hello,



I apologize for such a trivial question, but I'd like to use a
function other than "handler" as a perl handler. According to
the doc, it was possible in mod_perl 1, but I can't manage to
get it to work under mod_perl 2.




I am using Apache2::RequestRec which fine for me. I am using it as
an AuthenHandler and as the starter for our restfull web
application!



Questions?



Grtz,



Michel




--------------090503040900080903040702--

Re: Using a handler other than "handler"

am 27.09.2010 10:46:33 von bertolini.cedric

--00151750ec12f669f7049139c3df
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

@Michel,

Thanks for the reply. As far as I know, Apache2::RequestRec is a module tha=
t
provides several functions to manage the $request object provided by
mod_perl (http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html ). It'=
s
not really a handler, though most handlers use this module one way or
another. I just want to use a different handler than usual, but from the
same file, If that's possible.

@Nico

Thanks for the reply. Deciding on a behavior based on $r->uri or
$r->filename in the handler is what I was doing previously, but I'd love to
have a solution based the config file instead of the handler itself, for
robustness. I will have to stick to this solution if mod_perl doesn't let m=
e
provide the name of the handler, though.



2010/9/27 Nico Coetzee

> I had a similar requirement. My solution: based on the value of $r->uri()=
I
> would call the different subs from the main handler() sub. All the other
> subs take $r as the first argument and then the rest of the parameters
> follow.
>
> Probably not the best solution, but it worked for me.
>
> Cheers
>
> Nico
>
> 2010/9/27 C=E9dric Bertolini
>
> Hello,
>>
>> I apologize for such a trivial question, but I'd like to use a function
>> other than "handler" as a perl handler. According to the doc, it was
>> possible in mod_perl 1, but I can't manage to get it to work under mod_p=
erl
>> 2.
>>
>>
>> Here is an example of my code:
>>
>> file Authen.pm
>>
>> > sub handler {
>> > // regular handling
>> > }
>> >
>> > sub special {
>> > // special case
>> > }
>>
>> file httpd.conf
>>
>> >
>> > PerlAuthenHandler /lib/Authen
>> >

>>
>> >
>> > # I want to override the regular case by using "special" instead of
>> "handler" in /lib/Authen.pm
>> >

>>
>> Thanks in advance,
>> C=E9dric Bertolini
>>
>>
>

--00151750ec12f669f7049139c3df
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

@Michel,

Thanks=20
for the reply. As far as I know, Apache2::RequestRec is a module that=20
provides several functions to manage the $request object provided by=20
mod_perl ( ..html" target=3D"_blank">http://perl.apache.org/docs/2.0/api/Apache 2/Reques=
tRec.html
).
It's not really a handler, though most handlers use this module one wa=
y
or another. I just want to use a different handler than usual, but from
the same file, If that's possible.


@Nico

Thanks for the reply. Deciding on a behavior based on $r-&=
gt;uri or $r->filename in the handler is what I was doing=20
previously, but I'd love to have a solution based the config file=20
instead of the handler itself, for robustness. I will have to stick to=20
this solution if mod_perl doesn't let me provide the name of the=20
handler, though.




20=
10/9/27 Nico Coetzee < com">nicc777@gmail.com>
style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 20=
4); padding-left: 1ex;">
I had a similar requirement. My solution: based on the value of $r->uri(=
) I would call the different subs from the main handler() sub. All the othe=
r subs take $r as the first argument and then the rest of the parameters fo=
llow.



Probably not the best solution, but it worked for me.
<=
div>
Cheers

Nico

=3D"gmail_quote">2010/9/27 C=E9dric Bertolini < =3D"mailto:bertolini.cedric@gmail.com" target=3D"_blank">bertolini.cedric@g=
mail.com
>



r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> 63300">Hello,

I apologize for such a tr=
ivial question, but I'd like to use a function other than "handler=
" as a perl handler. According to the doc, it was possible in mod_perl=
1, but I can't manage to get it to work under mod_perl 2.





Here is an example of my code:

file Authen.pm

> su=
b handler {
> =A0 // regular handling
> }
>
> sub =
special {
> =A0 // special case
> }

file httpd.conf




> <Location /perl/>
>=A0 =A0 PerlAuthenHandler=A0 /lib/Authe=
n
> </Location>

> <Location /perl/special-case/>=
;
> =A0 # I want to override the regular case by using "special&=
quot; instead of "handler" in /lib/Authen.pm



> </Location>

Thanks in advance,
C=E9dric Bertolini
<=
br>






--00151750ec12f669f7049139c3df--

Re: Using a handler other than "handler"

am 27.09.2010 10:54:59 von aw

Hi.

You can use

PerlAuthenhandler Your::Module->special

See http://perl.apache.org/docs/2.0/user/coding/coding.html#Tech niques



Cédric Bertolini wrote:
> @Michel,
>
> Thanks for the reply. As far as I know, Apache2::RequestRec is a module that
> provides several functions to manage the $request object provided by
> mod_perl (http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html ). It's
> not really a handler, though most handlers use this module one way or
> another. I just want to use a different handler than usual, but from the
> same file, If that's possible.
>
> @Nico
>
> Thanks for the reply. Deciding on a behavior based on $r->uri or
> $r->filename in the handler is what I was doing previously, but I'd love to
> have a solution based the config file instead of the handler itself, for
> robustness. I will have to stick to this solution if mod_perl doesn't let me
> provide the name of the handler, though.
>
>
>
> 2010/9/27 Nico Coetzee
>
>> I had a similar requirement. My solution: based on the value of $r->uri() I
>> would call the different subs from the main handler() sub. All the other
>> subs take $r as the first argument and then the rest of the parameters
>> follow.
>>
>> Probably not the best solution, but it worked for me.
>>
>> Cheers
>>
>> Nico
>>
>> 2010/9/27 Cédric Bertolini
>>
>> Hello,
>>> I apologize for such a trivial question, but I'd like to use a function
>>> other than "handler" as a perl handler. According to the doc, it was
>>> possible in mod_perl 1, but I can't manage to get it to work under mod_perl
>>> 2.
>>>
>>>
>>> Here is an example of my code:
>>>
>>> file Authen.pm
>>>
>>>> sub handler {
>>>> // regular handling
>>>> }
>>>>
>>>> sub special {
>>>> // special case
>>>> }
>>> file httpd.conf
>>>
>>>>
>>>> PerlAuthenHandler /lib/Authen
>>>>

>>>>
>>>> # I want to override the regular case by using "special" instead of
>>> "handler" in /lib/Authen.pm
>>>>

>>> Thanks in advance,
>>> Cédric Bertolini
>>>
>>>
>

Re: Using a handler other than "handler"

am 27.09.2010 11:17:49 von bertolini.cedric

--001517570960be426904913a339c
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

@John

Thanks for the reply, but

PerlAuthenHandler Authen::special

doesn't work. It worked in mod_perl 1, but mod_perl 2 complains that it
can't find Authen/special.pm in @INC.


@Andr=E9,

Thanks for the reply. I was reluctant to use this solution because of the
OOC orientation of this syntax, but it isn't actually mandatory to define a
class in order to use this. You just have to be aware that the custom
handler will receive the request object as its second argument instead of
the first.

---
package Authen;

sub handler {
my ($r) =3D @_;
# regular case with $r as the request object
}

sub special {
my (undef, $r) =3D @_;
# special case with $r as the request object
}
---
PerlAuthenHandler Authen->special
---

Cheers,
C=E9dric Bertolini


2010/9/27 Andr=E9 Warnier

> Hi.
>
> You can use
>
> PerlAuthenhandler Your::Module->special
>
> See http://perl.apache.org/docs/2.0/user/coding/coding.html#Tech niques
>
>
>
>
> C=E9dric Bertolini wrote:
>
>> @Michel,
>>
>> Thanks for the reply. As far as I know, Apache2::RequestRec is a module
>> that
>> provides several functions to manage the $request object provided by
>> mod_perl (http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html ).
>> It's
>> not really a handler, though most handlers use this module one way or
>> another. I just want to use a different handler than usual, but from the
>> same file, If that's possible.
>>
>> @Nico
>>
>> Thanks for the reply. Deciding on a behavior based on $r->uri or
>> $r->filename in the handler is what I was doing previously, but I'd love
>> to
>> have a solution based the config file instead of the handler itself, for
>> robustness. I will have to stick to this solution if mod_perl doesn't le=
t
>> me
>> provide the name of the handler, though.
>>
>>
>>
>> 2010/9/27 Nico Coetzee
>>
>> I had a similar requirement. My solution: based on the value of $r->uri=
()
>>> I
>>> would call the different subs from the main handler() sub. All the othe=
r
>>> subs take $r as the first argument and then the rest of the parameters
>>> follow.
>>>
>>> Probably not the best solution, but it worked for me.
>>>
>>> Cheers
>>>
>>> Nico
>>>
>>> 2010/9/27 C=E9dric Bertolini
>>>
>>> Hello,
>>>
>>>> I apologize for such a trivial question, but I'd like to use a functio=
n
>>>> other than "handler" as a perl handler. According to the doc, it was
>>>> possible in mod_perl 1, but I can't manage to get it to work under
>>>> mod_perl
>>>> 2.
>>>>
>>>>
>>>> Here is an example of my code:
>>>>
>>>> file Authen.pm
>>>>
>>>> sub handler {
>>>>> // regular handling
>>>>> }
>>>>>
>>>>> sub special {
>>>>> // special case
>>>>> }
>>>>>
>>>> file httpd.conf
>>>>
>>>>
>>>>> PerlAuthenHandler /lib/Authen
>>>>>

>>>>>
>>>>> # I want to override the regular case by using "special" instead of
>>>>>
>>>> "handler" in /lib/Authen.pm
>>>>
>>>>>

>>>>>
>>>> Thanks in advance,
>>>> C=E9dric Bertolini
>>>>
>>>>
>>>>
>>
>

--001517570960be426904913a339c
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

@John

font>Thanks for the reply, but

PerlAuthenHandler Authen::special >
doesn't work. It worked in mod_perl 1, but mod_perl 2 complains th=
at it can't find Authen/ in=
@INC.



@Andr=E9,
<=
br>Thanks for the reply. I was reluctant to use this solution because of th=
e OOC orientation of this syntax, but it isn't actually mandatory to de=
fine a class in order to use this. You just have to be aware that the custo=
m handler will receive the request object as its second argument instead of=
the first.


---
package Authen;

sub handler {
=A0my ($r) =3D @_;
=
=A0# regular case
with $r as th=
e request object

rgia,serif">}


sub special {
=A0 my (undef, $r) =3D @_;
=A0 # special case with =
$r as the request object
}
---
0"> >PerlAuthenHandler Authen->special

---

Cheers,
C=E9dric Bertolini


s=3D"gmail_quote">2010/9/27 Andr=E9 Warnier < =3D"mailto:aw@ice-sa.com">aw@ice-sa.com>
=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid=
rgb(204, 204, 204); padding-left: 1ex;">
Hi.



You can use



PerlAuthenhandler Your::Module->special



See niques" target=3D"_blank">http://perl.apache.org/docs/2.0/user/codin g/codin=
g.html#Techniques








C=E9dric Bertolini wrote:

r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
@Michel,



Thanks for the reply. As far as I know, Apache2::RequestRec is a module tha=
t

provides several functions to manage the $request object provided by

mod_perl ( ..html" target=3D"_blank">http://perl.apache.org/docs/2.0/api/Apache 2/Reques=
tRec.html
). It's

not really a handler, though most handlers use this module one way or

another. I just want to use a different handler than usual, but from the >
same file, If that's possible.



@Nico



Thanks for the reply. Deciding on a behavior based on $r->uri or

$r->filename in the handler is what I was doing previously, but I'd =
love to

have a solution based the config file instead of the handler itself, for >
robustness. I will have to stick to this solution if mod_perl doesn't l=
et me

provide the name of the handler, though.







2010/9/27 Nico Coetzee < blank">nicc777@gmail.com>



r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I had a similar requirement. My solution: based on the value of $r->uri(=
) I

would call the different subs from the main handler() sub. All the other >
subs take $r as the first argument and then the rest of the parameters

follow.



Probably not the best solution, but it worked for me.



Cheers



Nico



2010/9/27 C=E9dric Bertolini < om" target=3D"_blank">bertolini.cedric@gmail.com>



Hello,

r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I apologize for such a trivial question, but I'd like to use a function=


other than "handler" as a perl handler. According to the doc, it =
was

possible in mod_perl 1, but I can't manage to get it to work under mod_=
perl

2.





Here is an example of my code:



file Authen.pm



r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
sub handler {

=A0// regular handling

}



sub special {

=A0// special case

}


file httpd.conf



r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<Location /perl/>

=A0 PerlAuthenHandler =A0/lib/Authen

</Location>

<Location /perl/special-case/>

=A0# I want to override the regular case by using "special" inst=
ead of


"handler" in /lib/Authen.pm

r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</Location>


Thanks in advance,

C=E9dric Bertolini














--001517570960be426904913a339c--

Re: Using a handler other than "handler"

am 27.09.2010 15:57:09 von mpeters

On 09/27/2010 05:17 AM, Cédric Bertolini wrote:

> PerlAuthenHandler Authen::special
>
> doesn't work. It worked in mod_perl 1, but mod_perl 2 complains that it
> can't find Authen/special.pm in @INC.

That's not what he suggested. He said:

PerlAuthenHandler Authen->special

Try that and see if it works

--
Michael Peters
Plus Three, LP